{include file="../application/admin/view/header.html"}
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-12">
	<div class="alert kesn_prompt"></div>
</div>


	<form class="navbar-form navbar-right" action="register_ouser_view" role="search"  method="get">
	  <div class="form-group">
	    <div class="input-group input-group-rounded">
	      <input class="form-control" id="keyword" name="keyword" type="search" placeholder="请输入用户名">
	      <span class="input-group-btn">
	        <button type="submit" class="btn kesn_search"><span class="fui-search"></span></button>
	      </span>
	    </div>
	  </div>
	</form>

</div><br/>
<div></div>
<div class="row">
	<table class="table table-hover">
		<thead>
			<th>ID</th>
			<th>用户</th>
			<th>仓库</th>
			<th>申请时间</th>
			<th>操作</th>
		</thead>
		<tbody>
		{volist name="lists" id="user"}
			<tr class="_item"> 
				<th scrope="row">{$user.id}</th>
				<td>{$user.user_name}</td>
				<td>{$user.warehouse}</td>
				<td>{$user.created}</td>
				<td><div>
					<a href="#" class="btn btn-primary btn-sm if_agree" data-agree="1">同意<span class="fui-check btn-tip"></span></a>
					<a href="#" class="btn btn-danger  btn-sm if_agree" data-agree="2">拒绝<span class="fui-cross btn-tip"></span></a>
				</div></td>
		
		</tr>
		{/volist}
	</tbody>
	{$page}
</div>	
</div>

{include file="../application/admin/view/footer.html"}
<script type="text/javascript">
//删除
$("._item").on('click','.kesn_del',function(){
	var _this = $(this);
	var _id = _this.attr('data-_id');
	var _name = _this.attr('data-_name');
	var _url = '/index.php/admin/user/del_admin';
	kesn_del(_id,_url,'您确实要删除'+_id+' : '+_name+' 吗？',_this);
});


$('body').on('click','.if_agree',function(){
	var _this = $(this);
	var this_item = _this.parents('._item');
	var user_id = this_item.find('th[scrope=row]').html();
	var if_agree = _this.attr('data-agree');

	$.ajax({
			url :'register',
			async:true,
			type:'GET',
			data:{
				'user_id':user_id,
				'if_agree':if_agree
			},
			dataType:'JSON',
			success:function(data,textStatus,jqXHR){
    				if (data.err != '0') {
    					kesn_prompt('fail',data.content);
    				}else if (data.err == '0') {
                        kesn_prompt('success',data.content);
                        window.location.reload();
                    }

    			},
    			error:function(){
    				kesn_prompt('fail','网络出错');
    			}
		});
});


</script>
</footer>
</body>
</html>